function showClassifySelect(isSave,id, levels,parentId,classifyType, all) {
	var data ;
	if(isSave == 1){
		data = getClassifyById(id,levels,parentId,classifyType);
	}else{
		data = getClassify(id,levels,parentId,classifyType);
	}
	var select = $("#" + id);
	select.empty();

	//if (all != undefined && all) {
		select.append("<option value=''>全部</option>");
	//}

	$.each(data, function(k, v) {
		select.append("<option value ='" + k + "'>" + v + "</option>");
	});

	return data;
}

function getClassify(type,levels,parentId,classifyType) {
	var v = sessionStorage[type];
	if (v == null || v == "") {
		$.ajax({
			type : 'post',
			url : '/convergeClassifys/findClassifyByParentId',
			data:'levels='+levels+'&parentId='+parentId+'&classifyType='+classifyType,
			async : false,
			success : function(data) {
				v = {};
				$.each(data, function(i, d) {
					v[d.i] = d.val;
				});

				sessionStorage[type] = JSON.stringify(v);
			}
		});
	}

	return JSON.parse(sessionStorage[type]);
}

function getClassifyById(type,levels,parentId,classifyType) {
	var v = new Array();
		$.ajax({
			type : 'post',
			url : '/convergeClassifys/findClassifyByParentId',
			data:'levels='+levels+'&parentId='+parentId+'&classifyType='+classifyType,
			async : false,
			success : function(data) {
				v = {};
				$.each(data, function(i, d) {
					v[d.i] = d.val;
				});

			}
		});
	return JSON.parse(JSON.stringify(v));
}


function initUpload(id,attId,imgId,type){
	layui.use(['upload','layer'], function(){
		  var layer = layui.layer;
		  var upload = layui.upload;
		  upload.render({ 
		    elem: '#'+id //绑定元素
		    ,accept: 'images' //允许上传的文件类型
		    ,url: '/upload/execute/'+type //上传接口
		    ,done: function(data, index, upload){
			            	 layer.msg("上传成功");
			            	 if(type == 1){
			            		 $("#"+attId).attr("value",data.osspath);
			            	 }else{
			            		 $("#"+attId).attr("value",data.id);
			            	 }
			                  
			     			 $("#"+imgId).attr("src", data.path);
		    }
		  });
		});
}
	
 